Código fuente de 'Busca elemento en array.asp'

<html>
<head>
<title>Busca elemento en array - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>

<p align="center"><b><font size="3">Busca elemento en array</font></b>
<body style="font-family: Arial; font-size: 11pt"></p>


<%

function BuscaElemento(arrName,srcStr)
dim I
dim pint,cnt

cnt=0

for i=0 to ubound(arrName)
if cnt=0 then
if srcStr=arrName(i) then
pint=i
cnt=1
end if
end if
next
BuscaElemento=pint+1
end function

 vector=array (4,3,2,1)
 Response.write "<b>Vector inicial: </b>4,3,2,1 </b><br><b>Función:</b> BuscaElemento(vector,1)<br>"
 response.write "<b>Elemento encontrado en la posición (empezando desde cero): </b>" & BuscaElemento(vector,1)
%>

</body>
</html>